package com.hbase.mr1;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;

public class Example1Driver {

	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

		// 创建一个job的configuration
		Configuration conf = HBaseConfiguration.create();

		// 创建job
		Job job = Job.getInstance(conf);

		job.setJobName("example1");

		job.setJarByClass(Example1Driver.class);

		// 配置job

		// 配置job的Mapper设置
		Scan scan = new Scan();
		TableMapReduceUtil.initTableMapperJob("t2", scan, Example1Mapper.class, Text.class, Put.class, job);

		// 配置job的Reducer设置
		TableMapReduceUtil.initTableReducerJob("t4", Example1Reducer.class, job);

		// 运行
		job.waitForCompletion(true);

	}

}
